//
//  DKAuthLeftCongraView.m
//  DanKU
//
//  Created by 蓝鳍互娱 on 2023/12/9.
//

#import "DKAuthLeftCongraView.h"
@interface DKAuthLeftCongraView()
@property (nonatomic,strong) UIImageView *dk_AuthSigleCongraImgView;
@property (nonatomic,strong) UILabel *dk_AuthSigleCongraHeadLab;
@property (nonatomic,strong) UILabel *dk_AuthSigleCongraValueLab;
@property (nonatomic,strong) UIImageView *dk_AuthSigleCongraBottomImgView;
@end
@implementation DKAuthLeftCongraView
-(instancetype)init{
    if(self == [super init]){
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    self.dk_AuthSigleCongraImgView = [[UIImageView alloc] init];
    self.dk_AuthSigleCongraImgView.image = DK_GetImage(@"dk_HomeCongratulaLeftBg");
    self.dk_AuthSigleCongraImgView.userInteractionEnabled = YES;
    [self addSubview:self.dk_AuthSigleCongraImgView];
    [self.dk_AuthSigleCongraImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@(DK_IsWidthScale(0)));
    }];
    self.dk_AuthSigleCongraHeadLab = [[UILabel alloc] init];
    self.dk_AuthSigleCongraHeadLab.textColor = DK_Hex(@"#FFFFFF");
    self.dk_AuthSigleCongraHeadLab.font = DK_FONT_Regular(14);
    self.dk_AuthSigleCongraHeadLab.text = @"Raise the limit";
    [self addSubview:self.dk_AuthSigleCongraHeadLab];
    [self.dk_AuthSigleCongraHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(DK_IsWidthScale(24)));
        make.centerX.equalTo(self);
        make.height.equalTo(@(DK_IsWidthScale(20)));
    }];
    self.dk_AuthSigleCongraValueLab = [[UILabel alloc] init];
    self.dk_AuthSigleCongraValueLab.textColor = DK_Hex(@"#FFFFFF");
    self.dk_AuthSigleCongraValueLab.font = DK_FONT_Regular(20);
    self.dk_AuthSigleCongraValueLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.dk_AuthSigleCongraValueLab];
    [self.dk_AuthSigleCongraValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.dk_AuthSigleCongraHeadLab.mas_bottom).offset(DK_IsWidthScale(7));
        make.left.equalTo(@(DK_IsWidthScale(0)));
        make.right.equalTo(@(DK_IsWidthScale(0)));
        make.height.equalTo(@(DK_IsWidthScale(24)));
    }];
    self.dk_AuthSigleCongraBottomImgView = [[UIImageView alloc] init];
    self.dk_AuthSigleCongraBottomImgView.userInteractionEnabled = YES;
    self.dk_AuthSigleCongraBottomImgView.image = DK_GetImage(@"dk_HomeCongratulaLeftIcon");
    [self addSubview:self.dk_AuthSigleCongraBottomImgView];
    [self.dk_AuthSigleCongraBottomImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.dk_AuthSigleCongraValueLab.mas_bottom).offset(DK_IsWidthScale(13));
        make.width.equalTo(@(DK_IsWidthScale(20)));
        make.height.equalTo(@(DK_IsWidthScale(20)));
    }];
    [self makeCongraData];
}
- (void)makeCongraData{
    DKUserComplaintModel * userComplaintMdl = [DKGlobalHelper defaultManager].userComplaintMdl;
    NSString * lastUserComplaintTotal = DK_GETObject_USERDEF(NSUserDefault_UserTotle);
    if(!lastUserComplaintTotal.length){
        lastUserComplaintTotal = @"0";
    }
    self.dk_AuthSigleCongraValueLab.text = [NSString stringWithFormat:@"%@ to %@",lastUserComplaintTotal,userComplaintMdl.total];
}
@end
